package com.mogist.hqc.module.personal.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.mogist.hqc.R
import com.mogist.hqc.entitys.response.ConsultVo
import com.mogist.hqc.util.Constant
import com.mogist.hqc.util.Util
import talex.zsw.basecore.util.DataTool
import talex.zsw.basecore.util.RegTool
import talex.zsw.basecore.util.SpTool
import talex.zsw.basecore.util.glide.GlideApp

/**
 * 作用：订单列表
 * 作者：赵小白 email:vvtale@gmail.com  
 * 修改人：
 * 修改时间：
 * 修改备注：
 */
class ConsultAdapter : BaseQuickAdapter<ConsultVo, BaseViewHolder>(R.layout.item_consult)
{
    override fun convert(helper: BaseViewHolder, item: ConsultVo)
    { // iTvName iTvTime iIvMore iTvInfo
        // iLLAnswer iTvName2 iTvTime2 iTvInfo2
        // iLLDetail iTvTag iTvTitle
        helper.setText(R.id.iTvName, DataTool.formatPhone(item.userName))
                .setText(R.id.iTvTime, Util.getTimeStr(item.createTime))
                .setText(R.id.iTvInfo, item.content)
                .setText(R.id.iTvName2, item.reName)
                .setText(R.id.iTvTime2, Util.getTimeStr(item.reTime))
                .setText(R.id.iTvInfo2, item.reContent)
                .setText(R.id.iTvTitle, item.pdtName)
                .setGone(R.id.iLLAnswer, RegTool.isNotEmpty(item.reName))
                .addOnClickListener(R.id.iIvMore)
                .addOnClickListener(R.id.iLLDetail)
        GlideApp.with(mContext)
                .load(SpTool.getString(Constant.STR_USER_PHOTO))
                .centerCrop()
                .into(helper.getView(R.id.iIcon))
    }
}